package org.jeecg.activiti.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.jeecg.activiti.entity.ActHiModelFormData;
import org.jeecg.activiti.entity.ActReModelFormData;
import org.jeecg.activiti.entity.ActivitiConstant;
import org.jeecg.activiti.mapper.ActHiModelFormDataMapper;
import org.jeecg.activiti.service.IActHiModelFormDataService;
import org.springframework.stereotype.Service;

/**
 * TODO 表单历史数据service
 *
 * @author dousw
 * @version 1.0
 * @date 2020/9/15 11:00
 */

@Service
public class ActHiModelFormDataServiceImpl extends ServiceImpl<ActHiModelFormDataMapper, ActHiModelFormData> implements IActHiModelFormDataService {

    @Override
    public void saveHiFormData(ActReModelFormData actReModelFormData, String processInstanceId) {
        ActHiModelFormData actHiModelFormData = new ActHiModelFormData();
        actHiModelFormData.setProcessDefinitionId(actReModelFormData.getProcessDefinitionId());
        actHiModelFormData.setFormData(actReModelFormData.getFormData());
        actHiModelFormData.setModelId(actReModelFormData.getModelId());
        actHiModelFormData.setFormId(actReModelFormData.getFormId());
        actHiModelFormData.setProcessInstanceId(processInstanceId);
        actHiModelFormData.setStatus(ActivitiConstant.HANDLE_STATUS_HLZ);
        actHiModelFormData.setCreateBy(actReModelFormData.getCreateBy());
        actHiModelFormData.setCreateTime(actReModelFormData.getCreateTime());
        actHiModelFormData.setUpdateBy(actReModelFormData.getUpdateBy());
        actHiModelFormData.setUpdateTime(actReModelFormData.getUpdateTime());
        actHiModelFormData.setType(actReModelFormData.getType());
        this.baseMapper.insert(actHiModelFormData);
    }
}
